<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>
    <script>
      // 功能1：求1~100的累加和
      var sum = 0;
      for (var i = 1; i <= 100; i++) {
        sum += i;
      }
      console.log(sum);

      // 功能2：求10~50的累加和
      var sum = 0;
      for (var i = 10; i <= 50; i++) {
        sum += i;
      }
      console.log(sum);
    </script>
  </body>
</html>